package com.easou.ps.master.rpc;

import java.util.concurrent.ConcurrentHashMap;

import com.easou.ps.common.servicehandle.ServiceAddress;

public class RPCProxyFactory {
	static ConcurrentHashMap<ServiceAddress, KSRPCProxy> proxyKsMap = new ConcurrentHashMap<ServiceAddress, KSRPCProxy>();
	
	public static KSRPCProxy getRPCKsProxy(ServiceAddress address) {
		KSRPCProxy proxy = proxyKsMap.get(address);
		if (proxy == null) {
			proxy = new KSRPCProxy(address);
			KSRPCProxy old = proxyKsMap.putIfAbsent(address, proxy);
			if (old != null) {
				proxy = old;
			}
		}
		return proxy;
	}
}
